#include <iostream>
using namespace std;

int partition(int a[], int l, int r) {
    int x = a[r];
    int i = l - 1;
    for (int j = l; j < r; ++j) {
        if (a[j] <= x) {
            ++i;
            std::swap(a[j], a[i]);
        }
    }
    std::swap(a[i + 1], a[r]);
    return i  + 1;
}

void quickSort(int a[], int n, int l, int r) {
    if (l < r) {
        int p = partition(a, l, r);
        quickSort(a, n, l, p - 1);
        quickSort(a, n, p + 1, r);
    }
}

int main() {
    int n;
    cin >> n;
    int a[1000] = {0};

    for (int i = 0; i < n; ++i) cin >> a[i];
    quickSort(a, n, 0, n - 1);
    for (int i = 0; i < n; ++i) cout << a[i] << " ";
    return 0;
}